import React, { Component } from "react";
import IceContainer from "@icedesign/container";
import BraftEditor from "braft-editor";
import "braft-editor/dist/braft.css";

export default class CustomBraftEditor extends Component {
  static displayName = "CustomBraftEditor";

  static propTypes = {};

  static defaultProps = {};

  constructor(props) {
    super(props);
    this.state = {};
  }

  handleRawChange = content => {
    console.log(content);
  };

  handleChange = rawContent => {
    console.log(rawContent);
  };

  render() {
    const editorProps = {
      height: 450,
      contentFormat: "html",
      initialContent: "<p></p>",
      onChange: this.handleChange,
      onRawChange: this.handleRawChange
    };

    return (
      <IceContainer title="活动正文">
        <BraftEditor {...editorProps} />
      </IceContainer>
    );
  }
}
